using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;
using System.Windows.Forms;
using Layout;

namespace CSDesktopUsiXMLRenderer
{
    class UsiXMLButtonRenderer : UsiXMLElementRenderer
    {

        public UsiXMLButtonRenderer()
        {
           
        }

        public override String getValidElementName(){
            return "button";
        }

        public override Control processRenderization(XmlNode element)
        {
            XmlElement elm = (XmlElement) element;
            String name = elm.GetAttribute("name");
            String isEnabled = elm.GetAttribute("isEnabled");
            String isVisible = elm.GetAttribute("isVisible");

            ElementsParser parser = new ElementsParser();

            Button button = new Button();
            button.Name = name;
            button.Enabled = parser.parseBoolean(isEnabled);
            button.Visible = parser.parseBoolean(isVisible);
            button.Width = 30;

            this.insertContent(element, button);

            return button;
        }

        public override UsiXMLElementRenderer getNextRenderer()
        {
            UsiXMLInputTextRenderer renderer = new UsiXMLInputTextRenderer();
            renderer.setInterfaceRenderer(this.usiXMLInterfaceRenderer);
            
            return renderer;
        }
    }
}
